﻿(function ($) {

    var initialdeletebutton = function (target, settings) {
        var $target = $(target);

        var $btn_deleteitem;
        if (settings.deleteitemEvent) {
            $btn_deleteitem = $('<div class="btn_deleteitem"></div>').prependTo(target);
            $btn_deleteitem.css('width', settings.size).css('height', settings.size).css('float', "right");
            var $cstimg = $('<img></img>').appendTo($btn_deleteitem).css('width', settings.size).css('height', settings.size);
            $cstimg.attr('src', '/images/onebit_35.png');
            $btn_deleteitem.click(settings.deleteitemEvent);
        }

        if (settings.valign == 'top') {
            if ($btn_deleteitem)
                $btn_deleteitem.css('margin-top', 0);
            
        }

       
    }

    jQuery.fn.adddeletebuttonFunctions = function (options) {
        settings = jQuery.extend({
            deleteitemEvent: null,
            valign: 'top',
            size: '20px'
        }, options);
        initialdeletebutton(this, settings);
        return this;
    };

})(jQuery);


